home *** CD-ROM | disk | FTP | other *** search
- Path: nntp-xfer-2.csn.net!yuma!steffend
- From: steffend@lamar.colostate.edu (Dave Steffen)
- Newsgroups: comp.lang.c++
- Subject: Re: Help!! I'm a stuck newbie - input problem
- Date: 30 Jan 1996 17:34:23 GMT
- Organization: Colorado State University, Fort Collins, CO 80523
- Distribution: world
- Message-ID: <4elkqv$3f2q@yuma.ACNS.ColoState.EDU>
- References: <4eh3vl$g8i@atlas.uniserve.com> <4eipbe$jnd@nic.cc.ruu.nl> <4ek25k$qta@atlas.uniserve.com>
- NNTP-Posting-Host: glitch.physics.colostate.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Chris (nowher@anyplace.com) wrote:
-
- > I have tried the strncpy function and it limits the length of the input.
- > I also tried cin.width which also nicely limited the length of the input
- > string. My exact problem is that I don't wan't the cursor to over-run
- > the width of the field:
-
- > Part Number:( )
- > Length:( )
- > Width:( )
- > .
- > .
- > .
-
-
- Ah... "This different question, grasshopper." The problem is
- then, "How do I get control of the cursor?"
-
- Two answers, one of them platform-dependent. If you're working
- with Borland on a PC, check out their "constrea.h" library - it's got
- exactly what you're looking for. If you're not on a PC, there may be a
- library you can use for screen control (Xwindows or something)?
-
- Otherwise, you may have to write your own input
- routine. Depending on what you do, this may or may not be platform
- specific.
-
- > The bracket on the right should be the limit of the input. I would like
- > to beep the user when/if the user reaches the right side of the field.
- > I have tried the getch() function in conjunction with wherex(), but this
- > failed. Perhaps I am asking the wrong question. What is the easiest way
- > of dealing with an array of char?
-
- > Actually, when I use char PartNum[20]; I have trouble assigning a
- > value to it. I get the error --Lvalue required--.
-
- Well, you can't assign to "PartNum" because that's a pointer
- to some chunk of memory, right? You can't assign to a memory
- address. What you want to do is assign to _what PartNum points to_,
- i.e. PartNum[0], PartNum[1]... Alternately, use strcpy to do it.
-
- /\
- \/
-
- Dave Steffen No, his mind is not for rent
- Dept. of Physics To any God or Government
- Colorado State University Always hopeful, yet discontent
- steffend@lamar.colostate edu He knows changes aren't permanent-
- But change is...
- "Speak softly...
- ... and carry a black belt!" -Neal Peart / RUSH
- -----------------------------------------------------------------------
-